package com.question.java.time.exec02;

import java.time.LocalDateTime;
import java.time.Month;
import java.time.Period;
import java.time.temporal.ChronoUnit;

/**
 * @Description: 根据现有实例创建日期和时间
 * minus和plus的相关应用
 * @Author: Jun Yang
 */
public class DateTimeExample07 {
    public static void main(String[] args) {
        Period period = Period.of(2, 3, 4); // 2年3月零4天
        LocalDateTime start = LocalDateTime.of(2018, Month.NOVEMBER,
                20, 17, 33, 0);
        LocalDateTime end = start.plus(period);
        System.out.println("end: " + end); // 2021-02-24T17:33

        end = end.plus(3, ChronoUnit.DAYS);
        System.out.println("end: " + end); //2021-02-27T17:33
    }

}
